library(sesame)
sesameDataCache()The main function to calculate the quality metrics is
sesameQC_calcStats. This function takes a SigDF, calculates
the QC statistics, and returns a single S4 sesameQC object,
which can be printed directly to the console. To calculate QC metrics on
a given list of samples or all IDATs in a folder, one can use
sesameQC_calcStats within the standard
openSesame pipeline. When used with
openSesame, a list of sesameQCs will be
returned. Note that one should turn off preprocessing using
prep="":
## calculate metrics on all IDATs in a specific folder
qcs = openSesame(idat_dir, prep="", func=sesameQC_calcStats)SeSAMe divides sample quality metrics into multiple groups. These groups are listed below and can be referred to by short keys. For example, “intensity” generates signal intensity-related quality metrics.
| Short.Key | Description |
|---|---|
| detection | Signal Detection |
| numProbes | Number of Probes |
| intensity | Signal Intensity |
| channel | Color Channel |
| dyeBias | Dye Bias |
| betas | Beta Value |
By default, sesameQC_calcStats calculates all QC groups.
To save time, one can compute a specific QC group by specifying one or
multiple short keys in the funs= argument:
sdfs <- sesameDataGet("EPIC.5.SigDF.normal")[1:2] # get two examples
## only compute signal detection stats
qcs = openSesame(sdfs, prep="", func=sesameQC_calcStats, funs="detection")
qcs[[1]]##
## =====================
## | Detection
## =====================
## N. Probes w/ Missing Raw Intensity : 0 (num_dtna)
## % Probes w/ Missing Raw Intensity : 0.0 % (frac_dtna)
## N. Probes w/ Detection Success : 837907 (num_dt)
## % Detection Success : 96.7 % (frac_dt)
## N. Detection Succ. (after masking) : 837907 (num_dt_mk)
## % Detection Succ. (after masking) : 96.7 % (frac_dt_mk)
## N. Probes w/ Detection Success (cg) : 835380 (num_dt_cg)
## % Detection Success (cg) : 96.7 % (frac_dt_cg)
## N. Probes w/ Detection Success (ch) : 2469 (num_dt_ch)
## % Detection Success (ch) : 84.2 % (frac_dt_ch)
## N. Probes w/ Detection Success (rs) : 58 (num_dt_rs)
## % Detection Success (rs) : 98.3 % (frac_dt_rs)
We consider signal detection the most important QC metric.
One can retrieve the actual stat numbers from sesameQC
using the sesameQC_getStats (the following generates the fraction of
probes with detection success):
sesameQC_getStats(qcs[[1]], "frac_dt")## [1] 0.9665611
After computing the QCs, one can optionally combine the
sesameQC objects into a data frame for easy comparison.
## combine a list of sesameQC into a data frame
head(do.call(rbind, lapply(qcs, as.data.frame)))Note that when the input is an SigDF object, calling
sesameQC_calcStats within openSesame and as a
standalone function are equivalent.
sdf <- sesameDataGet('EPIC.1.SigDF')
qc = openSesame(sdf, prep="", func=sesameQC_calcStats, funs=c("detection"))
## equivalent direct call
qc = sesameQC_calcStats(sdf, c("detection"))
qc##
## =====================
## | Detection
## =====================
## N. Probes w/ Missing Raw Intensity : 0 (num_dtna)
## % Probes w/ Missing Raw Intensity : 0.0 % (frac_dtna)
## N. Probes w/ Detection Success : 834922 (num_dt)
## % Detection Success : 96.3 % (frac_dt)
## N. Detection Succ. (after masking) : 834922 (num_dt_mk)
## % Detection Succ. (after masking) : 96.3 % (frac_dt_mk)
## N. Probes w/ Detection Success (cg) : 832046 (num_dt_cg)
## % Detection Success (cg) : 96.4 % (frac_dt_cg)
## N. Probes w/ Detection Success (ch) : 2616 (num_dt_ch)
## % Detection Success (ch) : 89.2 % (frac_dt_ch)
## N. Probes w/ Detection Success (rs) : 58 (num_dt_rs)
## % Detection Success (rs) : 98.3 % (frac_dt_rs)
SeSAMe features comparison of your sample with public data sets. The
sesameQC_rankStats() function ranks the input
sesameQC object with sesameQC calculated from
public datasets. It shows the rank percentage of the input sample as
well as the number of datasets compared.
sdf <- sesameDataGet('EPIC.1.SigDF')
qc <- sesameQC_calcStats(sdf, "intensity")
qc##
## =====================
## | Signal Intensity
## =====================
## Mean sig. intensity : 3171.21 (mean_intensity)
## Mean sig. intensity (M+U) : 6342.41 (mean_intensity_MU)
## Mean sig. intensity (Inf.II) : 2991.85 (mean_ii)
## Mean sig. intens.(I.Grn IB) : 3004.33 (mean_inb_grn)
## Mean sig. intens.(I.Red IB) : 4670.97 (mean_inb_red)
## Mean sig. intens.(I.Grn OOB) : 318.55 (mean_oob_grn)
## Mean sig. intens.(I.Red OOB) : 606.99 (mean_oob_red)
## N. NA in M (all probes) : 0 (na_intensity_M)
## N. NA in U (all probes) : 0 (na_intensity_U)
## N. NA in raw intensity (IG) : 0 (na_intensity_ig)
## N. NA in raw intensity (IR) : 0 (na_intensity_ir)
## N. NA in raw intensity (II) : 0 (na_intensity_ii)
sesameQC_rankStats(qc, platform="EPIC")##
## =====================
## | Signal Intensity
## =====================
## Mean sig. intensity : 3171.21 (mean_intensity) - Rank 15.7% (N=636)
## Mean sig. intensity (M+U) : 6342.41 (mean_intensity_MU)
## Mean sig. intensity (Inf.II) : 2991.85 (mean_ii) - Rank 15.6% (N=636)
## Mean sig. intens.(I.Grn IB) : 3004.33 (mean_inb_grn) - Rank 7.5% (N=636)
## Mean sig. intens.(I.Red IB) : 4670.97 (mean_inb_red) - Rank 21.2% (N=636)
## Mean sig. intens.(I.Grn OOB) : 318.55 (mean_oob_grn) - Rank 4.2% (N=636)
## Mean sig. intens.(I.Red OOB) : 606.99 (mean_oob_red) - Rank 3.6% (N=636)
## N. NA in M (all probes) : 0 (na_intensity_M)
## N. NA in U (all probes) : 0 (na_intensity_U)
## N. NA in raw intensity (IG) : 0 (na_intensity_ig)
## N. NA in raw intensity (IR) : 0 (na_intensity_ir)
## N. NA in raw intensity (II) : 0 (na_intensity_ii)
SeSAMe provides functions to create QC plots. Some functions takes sesameQC as input while others directly plot the SigDF objects. Here are some examples:
sesameQC_plotBar() takes a list of sesameQC objects
and creates bar plot for each metric calculated.
sesameQC_plotRedGrnQQ() graphs the dye bias between
the two color channels.
sesameQC_plotIntensVsBetas() plots the relationship
between β values and signal
intensity and can be used to diagnose artificial readout and influence
of signal background.
sesameQC_plotHeatSNPs() plots SNP probes and can be
used to detect sample swaps.
More about quality control plots can be found in Supplemental Vignette.
sessionInfo()## R version 4.2.0 (2022-04-22)
## Platform: aarch64-apple-darwin21.5.0 (64-bit)
## Running under: macOS Monterey 12.4
##
## Matrix products: default
## BLAS: /Users/zhouw3/.Renv/versions/4.2.0/lib/R/lib/libRblas.dylib
## LAPACK: /Users/zhouw3/.Renv/versions/4.2.0/lib/R/lib/libRlapack.dylib
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] knitr_1.39 sesame_1.15.6 sesameData_1.14.0
## [4] ExperimentHub_2.4.0 AnnotationHub_3.4.0 BiocFileCache_2.4.0
## [7] dbplyr_2.2.1 BiocGenerics_0.42.0 rmarkdown_2.14
## [10] R6_2.5.1
##
## loaded via a namespace (and not attached):
## [1] bitops_1.0-7 matrixStats_0.62.0
## [3] bit64_4.0.5 filelock_1.0.2
## [5] RColorBrewer_1.1-3 httr_1.4.3
## [7] GenomeInfoDb_1.32.2 tools_4.2.0
## [9] bslib_0.4.0 utf8_1.2.2
## [11] DBI_1.1.3 colorspace_2.0-3
## [13] tidyselect_1.1.2 preprocessCore_1.58.0
## [15] bit_4.0.4 curl_4.3.2
## [17] compiler_4.2.0 cli_3.3.0
## [19] Biobase_2.56.0 DelayedArray_0.22.0
## [21] sass_0.4.2 scales_1.2.0
## [23] readr_2.1.2 rappdirs_0.3.3
## [25] stringr_1.4.0 digest_0.6.29
## [27] XVector_0.36.0 pkgconfig_2.0.3
## [29] htmltools_0.5.3 MatrixGenerics_1.8.1
## [31] highr_0.9 fastmap_1.1.0
## [33] rlang_1.0.4 RSQLite_2.2.15
## [35] shiny_1.7.2 jquerylib_0.1.4
## [37] generics_0.1.3 jsonlite_1.8.0
## [39] wheatmap_0.2.0 BiocParallel_1.30.3
## [41] dplyr_1.0.9 RCurl_1.98-1.7
## [43] magrittr_2.0.3 GenomeInfoDbData_1.2.8
## [45] Matrix_1.4-1 Rcpp_1.0.9
## [47] munsell_0.5.0 S4Vectors_0.34.0
## [49] fansi_1.0.3 lifecycle_1.0.1
## [51] stringi_1.7.8 yaml_2.3.5
## [53] SummarizedExperiment_1.26.1 zlibbioc_1.42.0
## [55] plyr_1.8.7 grid_4.2.0
## [57] blob_1.2.3 parallel_4.2.0
## [59] promises_1.2.0.1 crayon_1.5.1
## [61] lattice_0.20-45 Biostrings_2.64.0
## [63] hms_1.1.1 KEGGREST_1.36.3
## [65] pillar_1.8.0 GenomicRanges_1.48.0
## [67] reshape2_1.4.4 codetools_0.2-18
## [69] stats4_4.2.0 glue_1.6.2
## [71] BiocVersion_3.15.2 evaluate_0.15
## [73] BiocManager_1.30.18 png_0.1-7
## [75] vctrs_0.4.1 tzdb_0.3.0
## [77] httpuv_1.6.5 gtable_0.3.0
## [79] purrr_0.3.4 assertthat_0.2.1
## [81] cachem_1.0.6 ggplot2_3.3.6
## [83] xfun_0.31 mime_0.12
## [85] xtable_1.8-4 later_1.3.0
## [87] tibble_3.1.8 AnnotationDbi_1.58.0
## [89] memoise_2.0.1 IRanges_2.30.0
## [91] ellipsis_0.3.2 interactiveDisplayBase_1.34.0
## [93] BiocStyle_2.24.0